﻿#region << 文 件 说 明 >>
/*----------------------------------------------------------------
// 文件名称：AddOrEditUcViewBase
// 创 建 者：杨程
// 创建时间：2021/10/13 13:13:33
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//		
//
//----------------------------------------------------------------*/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace Vampirewal.Core.WPF.Theme;

/// <summary>
/// 新增或修改页面基类
/// </summary>
public class AddOrEditUcViewBase:UcViewBase
{
    #region 界面

    #region 底部
    /// <summary>
    /// 底部模块菜单
    /// </summary>
    public List<UIElement> BottomBtnItems { get; set; } = new List<UIElement>();
    #endregion

    #endregion
    static AddOrEditUcViewBase()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(AddOrEditUcViewBase), new FrameworkPropertyMetadata(typeof(AddOrEditUcViewBase)));
    }
    /// <summary>
    /// 构造函数
    /// </summary>
    public AddOrEditUcViewBase()
    {
        //构造函数

        var AddOrEditUcViewBaseStyle = base.res["AddOrEditUcViewBase"] as Style;

        this.Style = AddOrEditUcViewBaseStyle;
    }

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();

        var BottomCustomArea = this.Template.FindName("BottomItems", this) as StackPanel;
        var Bottoms=this.Template.FindName("Bottom",this) as RowDefinition;

        if (BottomBtnItems.Count > 0)
        {
            //BottomCustomArea.Height = 50;
            foreach (var item in BottomBtnItems)
            {
                BottomCustomArea.Children.Add(item);
            }
        }
        else
        {
            Bottoms.Height = new GridLength(0);
        }
    }

}

public class DefaultUcViewBase : UcViewBase
{
    public DefaultUcViewBase()
    {
        var DefaultUcViewBaseStyle = base.res["DefaultUcViewBase"] as Style;

        this.Style = DefaultUcViewBaseStyle;
    }

    static DefaultUcViewBase()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(DefaultUcViewBase), new FrameworkPropertyMetadata(typeof(DefaultUcViewBase)));
    }
}